package com.doria.provider.controller;

import com.doria.common.pojo.po.User;
import com.doria.provider.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static org.springframework.http.ResponseEntity.ok;

@RequestMapping("/provider")
@RestController
@Slf4j
public class ProviderUserController {

    private final UserService userService;

    public ProviderUserController(UserService userService) {
        this.userService = userService;
    }

    @GetMapping("/getUser/{id}")
    public ResponseEntity<User> getUser(@PathVariable("id") String id) {
        User user = userService.userFindOne(id);
        log.info(user.toString());
        return ok(user);
    }
}
